/// @tags: DP
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

namespace BlueQuantum {

int const N = 1e6 + 5, M = 2e3 + 5, R = 3e2 + 5, mod = 1e9 + 7;

int r, s, n;
int block[M], f[2][R][M], map[R][R], q[N], rev[N];

inline int main() {
  cin >> r >> s >> n;
  for (int i = 1; i <= r; ++i)
    for (int j = 1; j <= s; ++j) cin >> map[i][j];
  for (int i = 1; i <= n; ++i) q[i] = (n - 1) / i + 1;
  int next = 1;
  for (int i = 1; i <= n; ++i) {
    if (q[i] != q[i - 1]) {
      block[next++] = q[i];
      rev[q[i]] = next - 1;
    }
  }
  f[1][1][rev[(n - 1) / map[1][1] + 1]] = 1;
  for (int i = 1; i <= r; ++i) {
    for (int j = 1; j <= s; ++j) {
      for (int k = 1; k < next; ++k) {
        if (i != r) {
          int& down = f[(i & 1) ^ 1][j][rev[(block[k] - 1) / map[i + 1][j] + 1]];
          down += f[i & 1][j][k];
          if (down >= mod) down -= mod;
        }
        if (j != s) {
          int& right = f[i & 1][j + 1][rev[(block[k] - 1) / map[i][j + 1] + 1]];
          right += f[i & 1][j][k];
          if (right >= mod) right -= mod;
        }
      }
    }
    if (i != r) memset(f[i & 1], 0, sizeof(f[i & 1]));
  }
  cout << f[r & 1][s][next - 1];
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P5307 [COCI2019] Mobitel.in", "r", stdin);
  freopen("P5307 [COCI2019] Mobitel.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
